Skip to content

transpile: Allow macro conversion to succeed only for some expansions#1806

Open
Rua wants to merge 4 commits into
immunant:masterfrom
Rua:macro-call-per-expr
Open

transpile: Allow macro conversion to succeed only for some expansions#1806
Rua wants to merge 4 commits into
immunant:masterfrom
Rua:macro-call-per-expr

Conversation

@Rua

@Rua Rua commented May 14, 2026

Copy link
Copy Markdown
Contributor

If there is ever a failure to convert one of the expansion sites of a macro, or it fails to fold into a single common type, then the entire macro is discarded and left in its expanded form. This PR adds a fallback mechanism: if the conversion succeeds for some of the expansion sites, then those will be converted to use the macro, and only the ones that failed will be left expanded.

The expr_results value stores all the errors of the conversion attempts for each expansion site. Currently, the Ok variant is just empty, but this is planned to hold information about functional macro arguments in the future.

@Rua Rua force-pushed the macro-call-per-expr branch 3 times, most recently from ec60c42 to fe546cc Compare May 15, 2026 11:45
@Rua Rua force-pushed the macro-call-per-expr branch 7 times, most recently from e06cb09 to 66cdc98 Compare May 29, 2026 16:22
@Rua Rua force-pushed the macro-call-per-expr branch from 66cdc98 to d7d679d Compare May 29, 2026 16:39

@ahomescu ahomescu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a test or snapshot you could add here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants